/*Diego Lima de Freitas RA: 317632
 *Yuri Souza Padua RA: 317420
 * 
 * Classe que trata a chamada de funções na linguagem
 */

package AST;

public class FunctionCall extends Expr {

    
    private Procedure function;
    private ExprList exprList;

    public FunctionCall(Procedure function, ExprList exprList) {
        this.function = function;
        this.exprList = exprList;
    }

    @Override
    public void genC(PW pw, boolean putParenthesis) {
        pw.out.print(function.getName() + "(");
        if (exprList != null) {
            exprList.genC(pw);
        }
        pw.out.print(")");
    }

    @Override
    public Type getType() {
        return function.getReturnType();
    }
}
